<?php
declare (strict_types = 1);

namespace app\admin\controller;
use think\facade\Request;
use think\facade\Db;
use think\facade\View;

class Ddgl
{
    // 备注
    //  再次上传
    public function indaa(){
        $where = [];
    }
    public function orderList()
    {
        $post = Request::post();
        $xia = Db::name('order_status')
                ->select();
        View::assign("xia",$xia);

        $where = [];
        $zhi = input('post.keywords');
        var_dump($zhi);
        if (isset($zhi) && !empty($zhi))$where[] = ['ecm_order.order_sn','like',"%{$zhi}%"];

        $zhi = input('post.cid');
        if (isset($zhi) && !empty($zhi))$where[] = ['c.status_id','=',"{$zhi}"];
        // 最低价格
        $zhi = input('post.di_prict');
        if (isset($zhi) && !empty($zhi))$where[] = ['ecm_order.price','>=',"$zhi"];
        // 最高价格
        $zhi = input('post.gao_prict');
        if (isset($zhi) && !empty($zhi))$where[] = ['ecm_order.price','<=',"$zhi"];
        // 开始时间
        $zhi = input('post.kaishi');

        if (isset($zhi) && !empty($zhi)){$zhi = strtotime($zhi);$where[] = ['ecm_order.addtime','>=',"$zhi"];}
        // 结束时间
        $zhi = input('post.jieshi');

        if (isset($zhi) && !empty($zhi)){$zhi = strtotime($zhi);$where[] = ['ecm_order.addtime','<=',"$zhi"];}
        View::assign($post);
        $list = Db::name('order')
            ->field('ecm_order.*,c.status_id ccid,c.order_status')
            ->join("ecm_order_status c","ecm_order.status = c.status_id",'left')
            ->where($where)
            ->select();
        View::assign('list',$list);




        return View();
    }

}